import { Message } from "@arco-design/web-vue";
import { request } from "../utils/request";
export const userApi = {
  import: "/user/import",
  list: "/user/list",
  del: "/user/:id",
};

export const importExcel = async (data) => {
  const res = await request("导入excel", {
    url: userApi.import,
    method: "post",
    data: data,
    headers: { "Content-Type": "multipart/form-data" },
  });
  if (res.success) {
    Message.success("导入成功");
  }
  return res;
};

export const findUsers = async () => {
  const res = await request("查询用户", {
    url: userApi.list,
    method: "get",
  });
  return res;
};

export const delUser = async (params) => {
  const res = await request("查询用户", {
    url: userApi.del,
    method: "delete",
    params,
  });
  if (res.success) {
    Message.success("删除成功");
  }
  return res;
};
